import Entity from "./Entity";

const {ccclass, property} = cc._decorator;

@ccclass
export default class NewClass extends cc.Component implements Entity {
    isCanMove(v3: cc.Vec3): boolean {
        
        return true;
    }
    doEvent(v3: cc.Vec3, node: cc.Node) {
        let gid=this.tiledLayer.getTileGIDAt(v3.x,v3.y);
        if(gid!=0){
            cc.log('open door gid:'+gid);
            this.tiledLayer.setTileGIDAt(0,v3.x,v3.y)
        }
       
        return true
    }

    tiledLayer:cc.TiledLayer=null;

    onLoad () {
        let tild=this.node.getComponent(cc.TiledMap);
        this.tiledLayer=tild.getLayer('door');
    }

    start () {

    }

    // update (dt) {}
}
